﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using org.mayb.Fixtures;
using org.mayb.Fixtures.Parser;
using Antlr.Runtime;

namespace SyntaxChecker
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void chkButton_Click(object sender, EventArgs e)
        {
            Antlr.Runtime.ANTLRStringStream stream = new Antlr.Runtime.ANTLRStringStream(txtInput.Text);
            FixtureLexer fl = new FixtureLexer(stream);
            CommonTokenStream cts = new CommonTokenStream(fl);
            FixtureParser fp = new FixtureParser(cts, new List<ObjectInfo>(), new List<string>());
            fp.top();
            string errors = fp.errorLog.ToString();
            if (errors == "")
                errors = "No syntax errors found.";
            Regex rex = new Regex("\\n");
            errors = rex.Replace(errors, "\r\n");
            txtOutput.Text = errors;
        }
    }
}
